package cn.zb.pojo;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;


@Entity
@Table(name="user",uniqueConstraints={@UniqueConstraint(columnNames={"email"})})
public class User implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1081140154534312198L;
	@Id
	@Column(name="id",length=4)
	@GeneratedValue(strategy=GenerationType.IDENTITY) 
	private int id;
	@Column(name="name",length=8)
	private String name; 
	@Column(name="password",length=16)
	private String password;
	@Column(name="email",length=20,nullable=false)
	private String email;
	@Column(name="QQ",length=12)
	private String QQ;
	@Column(name="tel",length=11)
	private String tel;
	@Column(name="intoTime")
	@Temporal(TemporalType.DATE)
	private Date intoTime ;
	@Column(name="headImage")
	@Lob
	private String headImage;
	@OneToMany	
	@JoinColumn(name="user_id")
	private List<UserFile> userFiles;
	@OneToMany	
	@JoinColumn(name="UId")
	private Set<Topic> topics;
	public Set<Topic> getTopics() {
		return topics;
	}
	public void setTopics(Set<Topic> topics) {
		this.topics = topics;
	}
	public List<UserFile> getUserFiles() {
		return userFiles;
	}
	public void setUserFiles(List<UserFile> userFiles) {
		this.userFiles = userFiles;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public Date getIntoTime() {
		return intoTime;
	}
	public void setIntoTime(Date intoTime) {
		this.intoTime = intoTime;
	}
	public String getHeadImage() {
		return headImage;
	}
	public void setHeadImage(String headImage) {
		this.headImage = headImage;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getQQ() {
		return QQ;
	}
	public void setQQ(String qQ) {
		QQ = qQ;
	}
	public String getTel() {
		return tel;
	}
	public void setTel(String tel) {
		this.tel = tel;
	}
}
